<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@include file="/WEB-INF/views/include/inc.jsp"%>
<!DOCTYPE html >
<html>
<head>
<%@include file="/WEB-INF/views/include/head.jsp"%>
</head>
<body style="background-color: white;" class="gray-bg">
<div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form  class="form-horizontal m-t" id="signupForm">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">角色名：</label>
                                <div class="col-sm-8">
                                    <input id="name" name="name" value="${role.name }" class="form-control" type="text">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">角色描述：</label>
                                <div class="col-sm-8">
                                    <input id="description" name="description" value="${role.description }" class="form-control" type="text" aria-required="true" aria-invalid="false" class="valid">
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-3">
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

    </div>
	<%@include file="/WEB-INF/views/include/foot.jsp"%>
	
	<!-- 自定义js -->
	<script
		src="<%=contextPath%>/assets/hplus/js/content.min.js?v=1.0.0"></script>

	<!-- jQuery Validation plugin javascript-->
	<script
		src="<%=contextPath%>/js/jquery.form.js"></script>
	<script
		src="<%=contextPath%>/assets/hplus/js/plugins/validate/jquery.validate.min.js"></script>
	<script
		src="<%=contextPath%>/assets/hplus/js/plugins/validate/messages_zh.min.js"></script>
	<script>
		$.validator.setDefaults({
			highlight : function(a) {
				$(a).closest(".form-group").removeClass("has-success")
						.addClass("has-error")
			},
			success : function(a) {
				a.closest(".form-group").removeClass("has-error").addClass(
						"has-success")
			},
			errorElement : "span",
			errorPlacement : function(a, b) {
				if (b.is(":radio") || b.is(":checkbox")) {
					a.appendTo(b.parent().parent().parent())
				} else {
					a.appendTo(b.parent())
				}
			},
			errorClass : "help-block m-b-none",
			validClass : "help-block m-b-none"
		});
		var index = parent.layer.getFrameIndex(window.name);
		$().ready(function() {
			$("#commentForm").validate();
			var a = "<i class='fa fa-times-circle'></i> ";
			$("#signupForm").validate({
				rules : {
				},
				messages : {
					name : a + "必填"
				},
				 submitHandler:function(form){
					 $(form).ajaxSubmit({
			            	url:'<%=contextPath%>/sys/role/add',
			            	type:'post',
			            	dataType:"json",
			            	success:function(data){
			            		if(data.code==200){
			            			parent.$('#search').text("reloadGrid");
				            		parent.layer.close(index); //执行关闭
			            		}else{
			            			
			            		}
			            	}
		              }); 
		        }
			});
		});
	</script>
</body>
</html>